

import delimited "$datapath/DECENNIALSF12010.P12_data_with_overlays_2021-12-13T133605.csv", rowrange(3) clear 

** population under 10: 
	gen popkids = p012003 + p012004 + p012027 + p012028 

** total population:
	split p012001, parse("(")
	gen pop = real(p0120011)


** observation identifiers 
	split geo_id, parse("US")

	gen fipsst  = real(substr(geo_id2,1,2))
	gen fipsplac = real(substr(geo_id2,3,10))

keep fipsst fipsplac pop popkids 

save "$datapath/clean/age_place_data.dta", replace 



/*
GEO_ID	id
NAME	Geographic Area Name
P012001	Total
P012002	Total!!Male
P012003	Total!!Male!!Under 5 years
P012004	Total!!Male!!5 to 9 years
P012005	Total!!Male!!10 to 14 years
P012006	Total!!Male!!15 to 17 years
P012007	Total!!Male!!18 and 19 years
P012008	Total!!Male!!20 years
P012009	Total!!Male!!21 years
P012010	Total!!Male!!22 to 24 years
P012011	Total!!Male!!25 to 29 years
P012012	Total!!Male!!30 to 34 years
P012013	Total!!Male!!35 to 39 years
P012014	Total!!Male!!40 to 44 years
P012015	Total!!Male!!45 to 49 years
P012016	Total!!Male!!50 to 54 years
P012017	Total!!Male!!55 to 59 years
P012018	Total!!Male!!60 and 61 years
P012019	Total!!Male!!62 to 64 years
P012020	Total!!Male!!65 and 66 years
P012021	Total!!Male!!67 to 69 years
P012022	Total!!Male!!70 to 74 years
P012023	Total!!Male!!75 to 79 years
P012024	Total!!Male!!80 to 84 years
P012025	Total!!Male!!85 years and over
P012026	Total!!Female
P012027	Total!!Female!!Under 5 years
P012028	Total!!Female!!5 to 9 years
P012029	Total!!Female!!10 to 14 years
P012030	Total!!Female!!15 to 17 years
P012031	Total!!Female!!18 and 19 years
P012032	Total!!Female!!20 years
P012033	Total!!Female!!21 years
P012034	Total!!Female!!22 to 24 years
P012035	Total!!Female!!25 to 29 years
P012036	Total!!Female!!30 to 34 years
P012037	Total!!Female!!35 to 39 years
P012038	Total!!Female!!40 to 44 years
P012039	Total!!Female!!45 to 49 years
P012040	Total!!Female!!50 to 54 years
P012041	Total!!Female!!55 to 59 years
P012042	Total!!Female!!60 and 61 years
P012043	Total!!Female!!62 to 64 years
P012044	Total!!Female!!65 and 66 years
P012045	Total!!Female!!67 to 69 years
P012046	Total!!Female!!70 to 74 years
P012047	Total!!Female!!75 to 79 years
P012048	Total!!Female!!80 to 84 years
P012049	Total!!Female!!85 years and over
*/